package com.longxi.tianjintianbao.api;

import com.google.gson.Gson;
import com.longxi.tianjintianbao.MyApplication;
import com.longxi.tianjintianbao.api.base.BaseApiRetrofit;
import com.longxi.tianjintianbao.api.fastjson.FastJsonConverterFactory;
import com.longxi.tianjintianbao.api.response.BaseResponse;
import com.longxi.tianjintianbao.api.response.BaseResponseWebPd;
import com.longxi.tianjintianbao.api.response.HttpResult;
import com.longxi.tianjintianbao.api.response.PgyCheck;
import com.longxi.tianjintianbao.greedao.entity.Patrol;
import com.longxi.tianjintianbao.greedao.entity.User;
import com.longxi.tianjintianbao.model.Build;
import com.longxi.tianjintianbao.model.ChangeFormal;
import com.longxi.tianjintianbao.model.CopeWith;
import com.longxi.tianjintianbao.model.Cost;
import com.longxi.tianjintianbao.model.GoodsTraffic;
import com.longxi.tianjintianbao.model.OAAuditing;
import com.longxi.tianjintianbao.model.OAPersonnel;
import com.longxi.tianjintianbao.model.Personnel;
import com.longxi.tianjintianbao.model.ReceiptList;
import com.longxi.tianjintianbao.model.RepairDetail;
import com.longxi.tianjintianbao.model.RepairList;
import com.longxi.tianjintianbao.model.RepairType;
import com.longxi.tianjintianbao.model.approval.Approval;
import com.longxi.tianjintianbao.model.approval.ApprovalContent;
import com.longxi.tianjintianbao.model.approval.ApprovalNextNode;
import com.longxi.tianjintianbao.model.assetrepair.AssetRepair;
import com.longxi.tianjintianbao.model.complaint.Complaint;
import com.longxi.tianjintianbao.model.complaint.ComplaintFollow;
import com.longxi.tianjintianbao.model.contact.ContactDepartment;
import com.longxi.tianjintianbao.model.equipment.AssetsDetail;
import com.longxi.tianjintianbao.model.equipment.Equipment;
import com.longxi.tianjintianbao.model.equipment.EquipmentInspection;
import com.longxi.tianjintianbao.model.equipment.EquipmentListDetails;
import com.longxi.tianjintianbao.model.equipment.EquipmentMaintain;
import com.longxi.tianjintianbao.model.equipment.EquipmentRepair;
import com.longxi.tianjintianbao.model.houseinspection.HouseCompensate;
import com.longxi.tianjintianbao.model.houseinspection.YanFang;
import com.longxi.tianjintianbao.model.maintain.AssetsMaintain;
import com.longxi.tianjintianbao.model.maintain.Maintain;
import com.longxi.tianjintianbao.model.message.MessageCount;
import com.longxi.tianjintianbao.model.message.MessageList;
import com.longxi.tianjintianbao.model.message.MessageListCount;
import com.longxi.tianjintianbao.model.meter.Meter;
import com.longxi.tianjintianbao.model.patrol.PatrolContent;
import com.longxi.tianjintianbao.model.quality.Quality;
import com.longxi.tianjintianbao.model.quality.QualityClass;
import com.longxi.tianjintianbao.model.quality.QualityItem;
import com.longxi.tianjintianbao.model.rectification.RectificationItem;
import com.longxi.tianjintianbao.model.rectification.RectificationList;
import com.longxi.tianjintianbao.model.repair.RepairAssets;
import com.longxi.tianjintianbao.model.task.Task;
import com.longxi.tianjintianbao.model.task.TaskProgress;
import com.longxi.tianjintianbao.model.visitor.CertificateType;
import com.longxi.tianjintianbao.model.visitor.Visitor;
import com.longxi.tianjintianbao.model.work.News;
import com.longxi.tianjintianbao.utils.LogUtils;
import com.longxi.tianjintianbao.utils.Md5Utils;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import rx.Observable;

/**
 * Created by kuma on 2018/4/12.
 * detail 使用Retrofit对网络请求进行配置
 */
public class ApiRetrofit extends BaseApiRetrofit {

    public MyApi mApi;
    public PgyApi mPGY;
    public volatile static ApiRetrofit mInstance;
    public String key = "ohQk0moiQTbgq5Ag";//合作方密匙

    public String _api_key = "12df5c449f5dcb7b16d8b6dfced41f46";
    public String pgyAppKey = "7a108dd9073fa9130ff7f0c9e0beb2b6";

    private static final OkHttpClient client = new OkHttpClient.Builder().
            connectTimeout(60, TimeUnit.SECONDS).
            readTimeout(60, TimeUnit.SECONDS).
            writeTimeout(60, TimeUnit.SECONDS).build();

    private ApiRetrofit() {
        super();

        //在构造方法中完成对Retrofit接口的初始化
        mApi = new Retrofit.Builder()
                .baseUrl(MyApplication.IP)
                .client(client)
                .addConverterFactory(FastJsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build()
                .create(MyApi.class);

        //在构造方法中完成对Retrofit接口的初始化
        mPGY = new Retrofit.Builder()
                .baseUrl(PgyApi.BASE_URL)
                .client(client)
                .addConverterFactory(FastJsonConverterFactory.create())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .build()
                .create(PgyApi.class);
    }

    public static ApiRetrofit getInstance() {
        if (mInstance == null) {
            synchronized (ApiRetrofit.class) {
                if (mInstance == null) {
                    mInstance = new ApiRetrofit();
                }
            }
        }
        return mInstance;
    }

    public static void clearInstance(){
        if(mInstance != null){
            mInstance = null;
        }
    }

    private RequestBody getRequestBody(Object obj) {
        String route = new Gson().toJson(obj);
        RequestBody body=RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"),route);
        return body;
    }

    public String sign(String method, String obj){
        String sign = Md5Utils.MD5Encode( method + "&"+ obj.toString() + "&key="+ key, "utf-8", true);
        LogUtils.d("api_method", method);
        LogUtils.d("api_json", obj);
        LogUtils.d("api_sign", sign);
        return sign;
    }

    //蒲公英获取版本
    public Observable<PgyCheck> pgyCheck(String buildKey) {
        return mPGY.pgyCheck(_api_key, pgyAppKey, buildKey);
    }

    //登录
    public Observable<HttpResult<User>> login(JSONObject obj) {
        return mApi.login("Login", obj.toString(), sign("Login", obj.toString()));
    }

    //登录
    public Observable<HttpResult<RepairType>> getRegionType(JSONObject obj) {
        return mApi.getRegionType("GetRegionType", obj.toString(), sign("GetRegionType", obj.toString()));
    }

    //获取房产信息
    public Observable<HttpResult<Build>> getUserBuild(JSONObject obj) {
        return mApi.getUserBuild("GetUserBuild", obj.toString(), sign("GetUserBuild", obj.toString()));
    }

    //员工所属小区保存
    public Observable<BaseResponse> saveUserBuild(JSONObject obj){
        return mApi.saveUserBuild("SaveUserBuild", obj.toString(), sign("SaveUserBuild", obj.toString()));
    }

    //获取房产信息
    public Observable<HttpResult<Build>> getBuilds(JSONObject obj) {
        return mApi.getBuilds("GetBuilds", obj.toString(), sign("GetBuilds", obj.toString()));
    }

    //报事报修保存
    public Observable<BaseResponse> saveEventRepair(JSONObject obj) {
        return mApi.saveEventRepair("SaveEventRepair", obj.toString(), sign("SaveEventRepair", obj.toString()));
    }

    //报事报修列表2
    public Observable<HttpResult<RepairList>> getEventRepairList2(JSONObject obj) {
        return mApi.getEventRepairList2("GetEventRepairList", obj.toString(), sign("GetEventRepairList", obj.toString()));
    }

    //获取报事报修信息
    public Observable<HttpResult<RepairDetail>> getEventRepair(JSONObject obj) {
        return mApi.getEventRepair("GetEventRepair", obj.toString(), sign("GetEventRepair", obj.toString()));
    }

    //获取人员列表
    public Observable<HttpResult<Personnel>> getPersonnel(JSONObject obj) {
        return mApi.getPersonnel("GetPersonnel", obj.toString(), sign("GetPersonnel", obj.toString()));
    }

    //报事报修派单
    public Observable<BaseResponse> dispatchEventRepair(JSONObject obj) {
        return mApi.dispatchEventRepair("DispatchEventRepair", obj.toString(), sign("DispatchEventRepair", obj.toString()));
    }

    //报事报修接单
    public Observable<BaseResponse> acceptEventRepair(JSONObject obj) {
        return mApi.acceptEventRepair("AcceptEventRepair", obj.toString(), sign("AcceptEventRepair", obj.toString()));
    }

    //获取资产信息
    public Observable<HttpResult<RepairAssets>> getRepairAssets(JSONObject obj) {
        return mApi.getRepairAssets("GetRepairAssets", obj.toString(), sign("GetRepairAssets", obj.toString()));
    }

    //报事报修开始维修
    public Observable<BaseResponse> startEventRepair(JSONObject obj) {
        return mApi.startEventRepair("StartEventRepair", obj.toString(), sign("StartEventRepair", obj.toString()));
    }

    //报事报修暂停（开始）
    public Observable<BaseResponse> suspendEventRepair(JSONObject obj) {
        return mApi.suspendEventRepair("SuspendEventRepair", obj.toString(), sign("SuspendEventRepair", obj.toString()));
    }

    //报事报修暂停（开始）
    public Observable<BaseResponse> completeEventRepair(JSONObject obj) {
        return mApi.completeEventRepair("CompleteEventRepair", obj.toString(), sign("CompleteEventRepair", obj.toString()));
    }

    //OA单据列表
    public Observable<HttpResult<ReceiptList>> getOAList(JSONObject obj) {
        return mApi.getOAList("GetOAList", obj.toString(), sign("GetOAList", obj.toString()));
    }

    //OA费用申请单
    public Observable<BaseResponse> saveCostApply(JSONObject obj) {
        return mApi.saveCostApply("SaveCostApply", obj.toString(), sign("SaveCostApply", obj.toString()));
    }

    //获取OA费用申请单
    public Observable<HttpResult<Cost>> getCostApply(JSONObject obj) {
        return mApi.getCostApply("GetCostApply", obj.toString(), sign("GetCostApply", obj.toString()));
    }

    //OA审批流程
    public Observable<HttpResult<OAAuditing>> getOAAuditing(JSONObject obj) {
        return mApi.getOAAuditing("GetOAAuditing", obj.toString(), sign("GetOAAuditing", obj.toString()));
    }

    //OA审批人员
    public Observable<HttpResult<OAPersonnel>> getOAPersonnel(JSONObject obj) {
        return mApi.getOAPersonnel("GetOAPersonnel", obj.toString(), sign("GetOAPersonnel", obj.toString()));
    }

    //OA应付款项申请单
    public Observable<BaseResponse> saveCopeWith(JSONObject obj) {
        return mApi.saveCopeWith("SaveCopeWith", obj.toString(), sign("SaveCopeWith", obj.toString()));
    }

    //获取OA应付款项申请单
    public Observable<HttpResult<CopeWith>> getCopeWith(JSONObject obj) {
        return mApi.getCopeWith("GetCopeWith", obj.toString(), sign("GetCopeWith", obj.toString()));
    }

    //OA转正申请单
    public Observable<BaseResponse> saveChangeFormal(JSONObject obj) {
        return mApi.saveChangeFormal("SaveChangeFormal", obj.toString(), sign("SaveChangeFormal", obj.toString()));
    }

    //获取OA转正申请单
    public Observable<HttpResult<ChangeFormal>> getChangeFormal(JSONObject obj) {
        return mApi.getChangeFormal("GetChangeFormal", obj.toString(), sign("GetChangeFormal", obj.toString()));
    }

    //OA审批
    public Observable<BaseResponse> saveOAAuditing(JSONObject obj) {
        return mApi.saveOAAuditing("SaveOAAuditing", obj.toString(), sign("SaveOAAuditing", obj.toString()));
    }

    //品质检查列表
    public Observable<HttpResult<Quality>> getQualityList(JSONObject obj) {
        return mApi.getQualityList("GetQualityList", obj.toString(), sign("GetQualityList", obj.toString()));
    }

    //品质检查类
    public Observable<HttpResult<QualityClass>> getQualityClass(JSONObject obj) {
        return mApi.getQualityClass("GetQualityClass", obj.toString(), sign("GetQualityClass", obj.toString()));
    }

    //品质检查类
    public Observable<HttpResult<QualityItem>> getQualityItem(JSONObject obj) {
        return mApi.getQualityItem("GetQualityItem", obj.toString(), sign("GetQualityItem", obj.toString()));
    }

    //品质检查打分
    public Observable<BaseResponse> saveQualityScore(JSONObject obj) {
        return mApi.saveQualityScore("SaveQualityScore", obj.toString(), sign("SaveQualityScore", obj.toString()));
    }

    //品质检查开始（结束）
    public Observable<BaseResponse> saveQualityState(JSONObject obj) {
        return mApi.saveQualityState("SaveQualityState", obj.toString(), sign("SaveQualityState", obj.toString()));
    }

    //品质整改列表
    public Observable<HttpResult<RectificationList>> getRectificationList(JSONObject obj) {
        return mApi.getRectificationList("GetRectificationList", obj.toString(), sign("GetRectificationList", obj.toString()));
    }

    //品质整改项目
    public Observable<HttpResult<RectificationItem>> getRectificationItem(JSONObject obj) {
        return mApi.getRectificationItem("GetRectificationItem", obj.toString(), sign("GetRectificationItem", obj.toString()));
    }

    //品质整改开始（结束）
    public Observable<BaseResponse> saveRectificationState(JSONObject obj) {
        return mApi.saveRectificationState("SaveRectificationState", obj.toString(), sign("SaveRectificationState", obj.toString()));
    }

    //品质整改保存
    public Observable<BaseResponse> saveRectification(JSONObject obj) {
        return mApi.saveRectification("SaveRectification", obj.toString(), sign("SaveRectification", obj.toString()));
    }

    //品质整改详情
    public Observable<HttpResult<RectificationList>> getRectification(JSONObject obj) {
        return mApi.getRectification("GetRectification", obj.toString(), sign("GetRectification", obj.toString()));
    }

    //品质整改保存
    public Observable<BaseResponse> saveTask(JSONObject obj) {
        return mApi.saveTask("SaveTask", obj.toString(), sign("SaveTask", obj.toString()));
    }

    //任务列表
    public Observable<HttpResult<Task>> getTaskList(JSONObject obj) {
        return mApi.getTaskList("GetTaskList", obj.toString(), sign("GetTaskList", obj.toString()));
    }

    //任务详情
    public Observable<HttpResult<Task>> getTask(JSONObject obj) {
        return mApi.getTask("GetTask", obj.toString(), sign("GetTask", obj.toString()));
    }

    //投诉列表
    public Observable<HttpResult<Complaint>> getComplaintList(JSONObject obj) {
        return mApi.getComplaintList("GetComplaintList", obj.toString(), sign("GetComplaintList", obj.toString()));
    }

    //投诉详情
    public Observable<HttpResult<Complaint>> getComplaintDetail(JSONObject obj) {
        return mApi.getComplaintDetail("GetComplaintDetail", obj.toString(), sign("GetComplaintDetail", obj.toString()));
    }

    //任务接单
    public Observable<BaseResponse> acceptTask(JSONObject obj) {
        return mApi.acceptTask("AcceptTask", obj.toString(), sign("AcceptTask", obj.toString()));
    }

    //添加任务进度
    public Observable<BaseResponse> addTaskProgress(JSONObject obj) {
        return mApi.addTaskProgress("AddTaskProgress", obj.toString(), sign("AddTaskProgress", obj.toString()));
    }

    //获取任务进度
    public Observable<HttpResult<TaskProgress>> getTaskProgress(JSONObject obj) {
        return mApi.getTaskProgress("GetTaskProgress", obj.toString(), sign("GetTaskProgress", obj.toString()));
    }

    //获取任务进度
    public Observable<BaseResponse> saveComplaint(JSONObject obj) {
        return mApi.saveComplaint("SaveComplaint", obj.toString(), sign("SaveComplaint", obj.toString()));
    }

    //调整信息
    public Observable<BaseResponse> updateComplaint(JSONObject obj) {
        return mApi.saveComplaint("UpdateComplaint", obj.toString(), sign("UpdateComplaint", obj.toString()));
    }

    //投诉立项
    public Observable<BaseResponse> projectComplaint(JSONObject obj) {
        return mApi.saveComplaint("ProjectComplaint", obj.toString(), sign("ProjectComplaint", obj.toString()));
    }

    //投诉接单
    public Observable<BaseResponse> receiveComplaint(JSONObject obj) {
        return mApi.saveComplaint("ReceiveComplaint", obj.toString(), sign("ReceiveComplaint", obj.toString()));
    }

    public Observable<BaseResponse> addComplaintFollow(JSONObject obj) {
        return mApi.saveComplaint("AddComplaintFollow", obj.toString(), sign("AddComplaintFollow", obj.toString()));
    }

    public Observable<HttpResult<ComplaintFollow>> getComplaintFollow(JSONObject obj) {
        return mApi.getComplaintFollow("GetComplaintFollow", obj.toString(), sign("GetComplaintFollow", obj.toString()));
    }

    public Observable<BaseResponse> complaintProgramme(JSONObject obj) {
        return mApi.saveComplaint("ComplaintProgramme", obj.toString(), sign("ComplaintProgramme", obj.toString()));
    }

    //访客登记列表
    public Observable<HttpResult<Visitor>> getVisitorList(JSONObject obj) {
        return mApi.getVisitorList("GetVisitorList", obj.toString(), sign("GetVisitorList", obj.toString()));
    }

    //访客登记
    public Observable<BaseResponse> saveVisitor(JSONObject obj) {
        return mApi.saveVisitor("SaveVisitor", obj.toString(), sign("SaveVisitor", obj.toString()));
    }

    //访客登记证件类型
    public Observable<HttpResult<CertificateType>> getCertificatetype(JSONObject obj) {
        return mApi.getCertificatetype("GetCertificatetype", obj.toString(), sign("GetCertificatetype", obj.toString()));
    }

    //访客离开登记
    public Observable<BaseResponse> saveVisitorLeave(JSONObject obj) {
        return mApi.saveVisitorLeave("SaveVisitorLeave", obj.toString(), sign("SaveVisitorLeave", obj.toString()));
    }

    //物品放行列表
    public Observable<HttpResult<GoodsTraffic>> getGoodsReleaseList(JSONObject obj) {
        return mApi.getGoodsReleaseList("GetGoodsReleaseList", obj.toString(), sign("GetGoodsReleaseList", obj.toString()));
    }

    //添加物品放行
    public Observable<BaseResponse> saveGoodsRelease(JSONObject obj) {
        return mApi.saveGoodsRelease("SaveGoodsRelease", obj.toString(), sign("SaveGoodsRelease", obj.toString()));
    }

    //物品放行离开登记
    public Observable<BaseResponse> saveGoodsLeave(JSONObject obj) {
        return mApi.saveGoodsLeave("SaveGoodsLeave", obj.toString(), sign("SaveGoodsLeave", obj.toString()));
    }

    //物品放行详情
    public Observable<HttpResult<GoodsTraffic>> getGoodsRelease(JSONObject obj) {
        return mApi.getGoodsRelease("GetGoodsRelease", obj.toString(), sign("GetGoodsRelease", obj.toString()));
    }

    //巡检列表
    public Observable<HttpResult<Patrol>> getInspectionList(JSONObject obj) {
        return mApi.getInspectionList("GetInspectionList", obj.toString(), sign("GetInspectionList", obj.toString()));
    }

    //巡检列表
    public Observable<HttpResult<com.longxi.tianjintianbao.model.patrol.Patrol>> getInspectionList2(JSONObject obj) {
        return mApi.getInspectionList2("GetInspectionList", obj.toString(), sign("GetInspectionList", obj.toString()));
    }

    //巡检明细
    public Observable<HttpResult<PatrolContent>> getInspectionDetail(JSONObject obj) {
        return mApi.getInspectionDetail("GetInspectionDetail", obj.toString(), sign("GetInspectionDetail", obj.toString()));
    }

    //巡检结果上传
    public Observable<BaseResponse> saveInspection(String obj) {
        return mApi.saveInspection("SaveInspection", obj, sign("SaveInspection", obj));
    }

    //巡检结果上传
    public Observable<BaseResponse> saveInspection2(JSONObject obj) {
        return mApi.saveInspection("SaveInspection", obj.toString(), sign("SaveInspection", obj.toString()));
    }

    public Observable<BaseResponse> saveInspection(JSONArray obj) {
        return mApi.saveInspection("SaveInspection", obj.toString(), sign("SaveInspection", obj.toString()));
    }

    //设备类别
    public Observable<HttpResult<Equipment>> getAssetsList(JSONObject obj) {
        return mApi.getAssetsList("GetAssetsList", obj.toString(), sign("GetAssetsList", obj.toString()));
    }

    //设备列表详情
    public Observable<HttpResult<EquipmentListDetails>> getEquipmentListDetails(JSONObject obj) {
        return mApi.getEquipmentListDetails("GetEquipmentListDetails", obj.toString(), sign("GetEquipmentListDetails", obj.toString()));
    }

    //设备巡检记录
    public Observable<HttpResult<EquipmentInspection>> getEquipmentInspection(JSONObject obj) {
        return mApi.getEquipmentInspection("GetEquipmentInspection", obj.toString(), sign("GetEquipmentInspection", obj.toString()));
    }

    //设备保养记录
    public Observable<HttpResult<EquipmentMaintain>> getEquipmentMaintain(JSONObject obj) {
        return mApi.getEquipmentMaintain("GetEquipmentMaintain", obj.toString(), sign("GetEquipmentMaintain", obj.toString()));
    }

    //设备维修记录
    public Observable<HttpResult<EquipmentRepair>> getEquipmentRepair(JSONObject obj) {
        return mApi.getEquipmentRepair("GetEquipmentRepair", obj.toString(), sign("GetEquipmentRepair", obj.toString()));
    }

    //设备保养列表
    public Observable<HttpResult<Maintain>> getEquipmentMaintainList(JSONObject obj) {
        return mApi.getEquipmentMaintainList("GetEquipmentMaintainList", obj.toString(), sign("GetEquipmentMaintainList", obj.toString()));
    }

    //设备保养保存
    public Observable<BaseResponse> saveEquipmentMaintain(JSONObject obj) {
        return mApi.saveEquipmentMaintain("SaveEquipmentMaintain", obj.toString(), sign("SaveEquipmentMaintain", obj.toString()));
    }

    //水电表列表
    public Observable<HttpResult<Meter>> getMetersList(JSONObject obj) {
        return mApi.getMetersList("GetMetersList", obj.toString(), sign("GetMetersList", obj.toString()));
    }

    //水电表度数保存
    public Observable<BaseResponse> saveMeterDegrees(JSONObject obj) {
        return mApi.saveMeterDegrees("SaveMeterDegrees", obj.toString(), sign("SaveMeterDegrees", obj.toString()));
    }

    //联系人列表
    public Observable<HttpResult<ContactDepartment>> getContactsList(JSONObject obj) {
        return mApi.getContactsList("GetContactsList", obj.toString(), sign("GetContactsList", obj.toString()));
    }

    //资产详情
    public Observable<HttpResult<AssetsDetail>> getAssetsDetail(JSONObject obj) {
        return mApi.getAssetsDetail("GetAssetsDetail", obj.toString(), sign("GetAssetsDetail", obj.toString()));
    }

    //获取信息个数
    public Observable<HttpResult<MessageCount>> getMessageCount(JSONObject obj) {
        return mApi.getMessageCount("GetMessageCount", obj.toString(), sign("GetMessageCount", obj.toString()));
    }

    //获取信息个数
    public Observable<HttpResult<MessageListCount>> getMessageListCount(JSONObject obj) {
        return mApi.getMessageListCount("GetMessageListCount", obj.toString(), sign("GetMessageListCount", obj.toString()));
    }

    //获取任务消息列表
    public Observable<HttpResult<MessageList>> getMessageList(JSONObject obj) {
        return mApi.getMessageList("GetMessageList", obj.toString(), sign("GetMessageList", obj.toString()));
    }

    //消息查看状态变更
    public Observable<BaseResponse> saveMessageLookOver(JSONObject obj) {
        return mApi.saveMessageLookOver("SaveMessageLookOver", obj.toString(), sign("SaveMessageLookOver", obj.toString()));
    }

    public Observable<HttpResult<News>> newsBulletin(JSONObject obj) {
        return mApi.newsBulletin("NewsBulletin", obj.toString(), sign("NewsBulletin", obj.toString()));
    }

    //我的审批
    public Observable<HttpResult<Approval>> myApproval(JSONObject obj) {
        return mApi.myApproval("MyApproval", obj.toString(), sign("MyApproval", obj.toString()));
    }

    //我的审批详情
    public Observable<HttpResult<ApprovalContent>> myApprovalDetail(JSONObject obj) {
        return mApi.myApprovalDetail("MyApprovalDetail", obj.toString(), sign("MyApprovalDetail", obj.toString()));
    }

    //我的审批详情
    public Observable<BaseResponse> myApprovalSave(JSONObject obj) {
        return mApi.myApprovalSave("MyApprovalSave", obj.toString(), sign("MyApprovalSave", obj.toString()));
    }

    //下一流程步骤
    public Observable<HttpResult<ApprovalNextNode>> myApprovalNextNode(JSONObject obj) {
        return mApi.myApprovalNextNode("MyApprovalNextNode", obj.toString(), sign("MyApprovalNextNode", obj.toString()));
    }

    //任务列表
    public Observable<BaseResponseWebPd> validate(JSONObject obj) {
        return mApi.validate("AssetsWebService", obj.toString(), sign("AssetsWebService", obj.toString()));
    }

    //资产维修
    public Observable<HttpResult<AssetRepair>> getAssetsRepair(JSONObject obj) {
        return mApi.getAssetsRepair("GetAssetsRepair", obj.toString(), sign("GetAssetsRepair", obj.toString()));
    }

    //资产保养
    public Observable<HttpResult<AssetsMaintain>> getAssetsMaintain(JSONObject obj) {
        return mApi.getAssetsMaintain("GetAssetsMaintain", obj.toString(), sign("GetAssetsMaintain", obj.toString()));
    }

    //获取入住验房列表
    public Observable<HttpResult<YanFang>> getCheckInList(JSONObject obj) {
        return mApi.getCheckInList("GetCheckInList", obj.toString(), sign("GetCheckInList", obj.toString()));
    }

    //获取入住验房信息
    public Observable<HttpResult<YanFang>> getCheckIn(JSONObject obj) {
        return mApi.getCheckIn("GetCheckIn", obj.toString(), sign("GetCheckIn", obj.toString()));
    }

    //获取入住验房信息
    public Observable<BaseResponse> checkInSave(JSONObject obj) {
        return mApi.checkInSave("CheckInSave", obj.toString(), sign("CheckInSave", obj.toString()));
    }

    //获取入住验房信息
    public Observable<BaseResponse> checkOutSave(JSONObject obj) {
        return mApi.checkInSave("CheckOutSave", obj.toString(), sign("CheckOutSave", obj.toString()));
    }

    //获取入住验房信息
    public Observable<HttpResult<HouseCompensate>> getCompensate(JSONObject obj) {
        return mApi.getCompensate("GetCompensate", obj.toString(), sign("GetCompensate", obj.toString()));
    }

    //资产赔偿保存
    public Observable<BaseResponse> compensateSave(JSONObject obj) {
        return mApi.compensateSave("CompensateSave", obj.toString(), sign("CompensateSave", obj.toString()));
    }

    //获取入住验房信息
    public Observable<BaseResponse> createCompensate(JSONObject obj) {
        return mApi.checkInSave("CreateCompensate", obj.toString(), sign("CreateCompensate", obj.toString()));
    }

    //入住验房完成保存
    public Observable<BaseResponse> checkInFinishSave(JSONObject obj) {
        return mApi.checkInSave("CheckInFinishSave", obj.toString(), sign("CheckInFinishSave", obj.toString()));
    }

    //退住验房完成保存
    public Observable<BaseResponse> checkOutFinishSave(JSONObject obj) {
        return mApi.checkInSave("CheckOutFinishSave", obj.toString(), sign("CheckOutFinishSave", obj.toString()));
    }

    //退住验房完成保存
    public Observable<BaseResponse> compensateFinishSave(JSONObject obj) {
        return mApi.checkInSave("CompensateFinishSave", obj.toString(), sign("CompensateFinishSave", obj.toString()));
    }

    //维修计划保存
    public Observable<BaseResponse> eventRepairPlan(JSONObject obj) {
        return mApi.dispatchEventRepair("EventRepairPlan", obj.toString(), sign("EventRepairPlan", obj.toString()));
    }
}
